package crtl;
/**
 * @author Benjamin
 */
public final class Speed {
	private double _left = 0.0;
	private double _right = 0.0;
	
	public Speed(double left, double right) throws SetSpeedException {
		setLeft(left);
		setRight(right);
	}

	public double getLeft() {
		return _left;
	}

	public void setLeft(double left) throws SetSpeedException {
		checkValue(left);
		_left = left;
	}

	public double getRight() {
		return _right;
	}

	public void setRight(double right) throws SetSpeedException {
		checkValue(right);
		_right = right;
	}

	private void checkValue(double value) throws SetSpeedException {
		if ((value < -1) || (value > 1)) {
			throw new SetSpeedException("Value must be between 0 and 1");
		}
	}

}
